#!/usr/bin/python3
#coding:utf-8
from my_udp import UDP_Manager
import numpy as np

def Callback(data, addr):
    global img
    data = np.frombuffer(data, dtype=np.uint8)
    img = cv2.imdecode(data, cv2.IMREAD_COLOR)
    
if __name__ == '__main__':
    import cv2
    import time
    cv2.namedWindow('1', 0)
    UDPServer = UDP_Manager(Callback, buffSize = 640 * 480, isServer = False)
    UDPServer.Start()
    img = np.zeros((480, 640), np.uint8)
    UDPServer.Send(b'123', ('192.168.8.107', 8888))
    while True:
        cv2.imshow('1', img)
        if cv2.waitKey(1) & 0xFF == ord('q'):
            break
        
        
    '  图像过大，降低画质后重试  '
